# -*- coding: utf-8 -*-

'''
@project : AIGateWay_fastapi
@FileName: t_error_log_dao
@Author  :linych 
@Time    :2020/12/18 21:25
@Desc  : 
'''

import ailog

from Core import mysql_log_loop



async def insert_ability_error_log(func='', code='', message='', key_word='', error_level='', error_type='', create_time=''):
    try:

        ailog.info('insert_ability_error_log')

        message = message.replace("'", '')

        sql = "insert into ai_ability_error_log (func,code,message,key_word,error_level,error_type,create_time) \
           VALUES ('{}','{}','{}','{}','{}','{}','{}')".format(func,code,message,key_word,error_level,error_type,create_time)

        await mysql_log_loop.db_util.execute(sql)
        ailog.debug(sql)
    except Exception as e:
        ailog.error('Mysql error : {}'.format(e))
